function [img] = das(rfdata, t_array, elem_pos, x_vec, y_vec, c)

[y, x] = meshgrid(y_vec, x_vec);
delay = zeros(numel(y_vec), numel(x_vec), size(elem_pos, 1));
for i = 1 : size(elem_pos, 1)
    delay(:, :, i) = 2 * sqrt((x - elem_pos(i, 1)).^2 + (y - elem_pos(i, 2)).^2) / c + 2 / 5e6;
end

img = zeros(size(delay));
for i = 1 : size(elem_pos, 1)
    img(:, :, i) = interp1(t_array, rfdata(:, i), delay(:, :, i), "linear", 0.0);
end

end